$(function () {
//添加方法
    $("#bannerAdd").click(function () {
            let bannerName=$("#register .bannerName").val();
            let bannerLink=$("#register .bannerLink").val();
            let bannerPicture=$("#register .bannerPicture").val();
            let arr={ "bannerName":bannerName,
                "bannerLink":bannerLink,
                "bannerPicture":bannerPicture};
            $.ajax({
                url:'http://192.168.1.118/qa/banner/addBanner',
                type:"POST",
                data: JSON.stringify(arr),
                contentType: 'application/json; charset=utf-8',
                dataType:'json',
                async:true,
                success:function (data) {
                    if(data.code==="100"){
                        //调用刷新包装函数
                        ajaxDefrence();
                        $("#register").fadeOut(300);
                    }else{
                        alert(data.msg);
                    }
                },
            });
    });
//修改方法
    $("#bannerChange").click(function () {
        let bannerName=$("#changeCover .bannerName").val();
        let bannerLink=$("#changeCover .bannerLink").val();
        let bannerPicture=$("#changeCover .bannerPicture").val();
        let id=$("#changeCover #bannerId").val();
        let arr={ "bannerId":id,
            "bannerName":bannerName,
            "bannerLink":bannerLink,
            "bannerPicture":bannerPicture};
        $.ajax({
            url:'http://192.168.1.118/qa/banner/updateBanner',
            type:"POST",
            data: JSON.stringify(arr),
            contentType: 'application/json; charset=utf-8',
            dataType:'json',
            async:true,
            success:function (data) {
                if(data.code==="100"){
                    ajaxDefrence();
                    $("#changeCover").fadeOut(300);
                }else{
                    alert(data.msg);
                }
            },
        });
    })
});
